import request from 'src/axios'

/**
 * @description 分页查询商品分类列表
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageProductCategory = (params: object) => {
  return request.get('/metadata/productCategory/page', { params })
}

/**
 * @description 查询所有商品分类
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const listProductCategory = (params?: object) => {
  return request.get('/metadata/productCategory/list', { params })
}

/**
 * @description 查看商品分类信息
 * @param { String } id 商品分类主键
 * @returns Promise
 */
export const viewProductCategory = (id: string) => {
  return request.get('/metadata/productCategory', { params: { id } })
}

/**
 * @description 新增商品分类
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveProductCategory = (data: object) => {
  return request.post('/metadata/productCategory', data)
}

/**
 * @description 修改商品分类
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateProductCategory = (data: object) => {
  return request.put('/metadata/productCategory', data)
}

/**
 * @description 删除商品分类
 * @param { Array<string> } ids 商品分类主键数组
 * @returns Promise
 */
export const deleteProductCategory = (ids: Array<string>) => {
  return request.delete('/metadata/productCategory', { data: ids })
}

/**
 * @description 启用商品分类
 * @param { String } id 商品分类主键
 * @returns Promise
 */
export const enableProductCategory = (id: string) => {
  return request.put('/metadata/productCategory/enable', { id })
}

/**
 * @description 禁用商品分类
 * @param { String } id 商品分类主键
 * @returns Promise
 */
export const disableProductCategory = (id: string) => {
  return request.put('/metadata/productCategory/disable', { id })
}
